#!/usr/bin/evn python
# -*- coding: UTF-8 -*-
# @File: wechat.py
# @Author: fy
# @date: 2021/10/24 17:41
from base_apis.BaseApis import BaseApis


class WeChat(BaseApis):
    '''
    企业微信
    '''
    token = None

    def get_token_id(self, corpid, secret):
        '''

        '''
        url = f"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={corpid}&corpsecret={secret}"
        resp = self.send("GET", url)
        self.token = resp.json()['access_token']

    def get_corp_list_tag_token(self):
        #     '''
        #     获取企业客户标签的token
        #     :return:
        #     '''
        #     corpid = "ww36a71183e4f8c31a"
        #     contact_secret = "4CCWnbAgjXGBnN5dqUcWFwOkyJYSqGZAVeuvbc9xanA"
        #     corp_tag_secret = 'H_nhfNRkEIKAN0xvuzXQhYJvkBzVq2tk5j-bzvHmvFk'
        #     url = f"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={corpid}&corpsecret={corp_tag_secret}"
        #     resp = self.send("GET", url)
        #     self.token = resp.json()['access_token']
        pass


    def get_department_token(self):
        '''
        获取部门管理的token
        :return:
        '''
        corpid = "ww36a71183e4f8c31a"
        contact_secret = "4CCWnbAgjXGBnN5dqUcWFwOkyJYSqGZAVeuvbc9xanA"
        url = f"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={corpid}&corpsecret={contact_secret}"
        resp = self.send("GET", url)
        self.token = resp.json()['access_token']
